package com.test;

import java.util.*;
import java.util.regex.Pattern;

/**
 * Created by zhaopeng on 3/1/17.
 */
public class VerifyCharmData extends ReadFileByLine {
    private int[] eduTag = {11271, 11272, 11273, 11274};
    private int[] sexTag = {562, 563};

    private Set<Integer> set = new HashSet<>();
    private int count = 0;

    @Override
    protected void beginReadFile() {
        count = 0;
        for (int i : eduTag) {
            set.add(i);
        }
    }

    protected void doReadAction(String line) {
        String[] array = line.split(Pattern.quote("\t"));
        if (2 > array.length)
            return;

        List<Integer> list = new ArrayList<>();
        for (String str : array[1].split(Pattern.quote(","))) {
            int num = Integer.parseInt(str);
            if (set.contains(num)) {
                list.add(num);
            }

        }

        if (list.size() == 0) {
            System.out.println(line);
        }


    }

    protected void doFileDone() {
        System.out.println(count);
    }

    public static void main(String[] args) throws Exception {
        VerifyCharmData v = new VerifyCharmData();
        v.readFile(args[0]);
    }
}
